package com.tj.jinzao.presenter;

import android.util.Log;

import com.tj.jinzao.api.SubscriberCallBack;
import com.tj.jinzao.base.BasePresenter;
import com.tj.jinzao.callback.IListView;
import com.tj.jinzao.manager.UserManager;
import com.tj.jinzao.model.Comment;
import com.tj.jinzao.model.ResultResponse;

import java.util.List;

/**
 * 我的评论处理
 * Created by wjy 2018/12/10.
 */
public class MyCommentPresenter extends BasePresenter<IListView<List<Comment>>> {

    public MyCommentPresenter(IListView<List<Comment>> view) {
        super(view);
    }

    public void getCommentList(int page,String order,long id) {
        addSubscription(mApiService.getCommentMeOther(page, id,order), new SubscriberCallBack<List<Comment>>(mView.getContext()) {
            @Override
            protected void onSuccess(List<Comment> list) {
                if (mView != null) mView.onRequestSuccess(list);
            }

            @Override
            protected void onFailure(ResultResponse response) {
                Log.w("用户病例数据",""+response.getMessage());
                if (mView != null) mView.onRequestError(response.getMessage());
            }

            @Override
            protected boolean isShowProgress() {
                return true;
            }

            @Override
            protected void onPageSuccess(int currentPage, int allPage, int allSize) {
                if (mView != null) mView.onRequestSuccessPage(currentPage, allPage, allSize);
            }
        });
    }

}
